package oop4.driver;

public class Driver {
    public static void main(String[] args) {
        // public FighterPlane(String brand,  int heightMax, int weight, int ammo)
        Driver driver = new Driver();
        PassengerPlane p1 = new PassengerPlane("空客", "北京-华盛顿", 20000, 10, 50);
        FighterPlane p2 = new FighterPlane("F16", 30000, 6, 3);
        driver.drive(p1);
        System.out.println();
        driver.drive(p2);
    }

    public void drive(Airplane a) {
        if (a instanceof PassengerPlane)
            System.out.println("飞行员驾驶客机");
        else if (a instanceof FighterPlane)
            System.out.println("飞行员驾驶战斗机");
        a.show();
        a.fly();
        a.speedUp();
        a.land();
        if (a instanceof FighterPlane) {
            FighterPlane b = (FighterPlane) a;
            b.lowHover();
            b.shootMissiles();
        }

    }
}
